<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .red{
            width: 300px;
            height: 300px;
            background-color: red;
        }
        .green{
            width: 200px;
            height: 200px;
            background-color: green;
        }
        .blue{
            width: 100px;
            height: 100px;
            background-color: blue;
        }
    </style>
</head>
<body>
    <div id="app">
        <div class="red" @click="showMeg('red')">
            <div class="green" @click.stop="showMeg('green')"><!-- .stop阻止事件冒泡 -->
                <div class="blue">
                    <a href="http://www.baidu.com" @click.prevent.stop="showMeg('yellow')">百度</a><!-- 阻止默认事件又阻止冒泡 -->
                </div>
            </div>
        </div>
    </div>
</body>
</html>
<script src="./vue.js"></script>
<script>
    new Vue({
        el:'#app',
        methods:{
            showMeg(color){
                alert(`你单机了${color}色盒子`)
            }
        }
    })
</script>